home *** CD-ROM | disk | FTP | other *** search
- /* Example sound player. It reads the command from ENV:RODreamSound and
- adds the sample to play at the end of the string, so the variable in
- ENV: sould be for example 'run >nil: c:xplay nfl sounds=' (without
- quotas of course). This isn't a proper way to play samples with ReqAttack,
- but I understand that RASoundDeamon which uses datatypes isn't very
- good either.
-
- Program suggested by BKJ (Vulture@freemail.gr).
-
- IMPORTANT: To protect ReqOFF againts going into infinitive loop (when your
- requester replacer calls EasyRequestArgs() with same TITLE and/or TEXT
- as the original requester) you should add a single space as a first byte
- of title string, or simply change it to other title which will not qualify
- to be patched by your program again and again and again...
-
- IMPORTANT: In 'replacerdata' structure you receive not only the easystruc,
- but also the screen pointer, idcmp and args with which the main
- EasyRequestArgs was called. The 1st thing is that is not guaranteed that the
- screen is still opened (I think it's better to call EasyRequestArgs() with
- a NIL/NULL screen pointer because all users probably use DefaultPubScreen
- patches). The 2nd is that idcmp and args may be passed incorrectly by
- ReqOFF/other software (???) because mine programs hanged with these args
- passed to EasyRequestArgs - so don't use them!
- */
-
- MODULE 'dos/dos','intuition/intuition','other/replacer'
-
- DEF pos
- DEF newtitle:PTR TO LONG,exit=0,fh,file[1501]:STRING,fib[260]:ARRAY OF CHAR,fibl:PTR TO fileinfoblock
- DEF file2[1001]:STRING,re:PTR TO replacerdata
-
- PROC main()
- IF fh:=Open('ENV:RODreamSound.prefs',MODE_OLDFILE)
- ExamineFH(fh,fib);fibl:=fib -> read the command to execute...
- Read(fh,file,fibl.size)
- file[fibl.size+1]:=NIL
- Close(fh)
-
- IF StrCmp(arg,'"',1) -> the 1st arg is sample name
- pos:=InStr(arg,'"',1) -> which has to be specified in
- StrCopy(file2,arg,pos) -> RAPrefsMUI
- ELSE
- pos:=InStr(arg,' ',1)
- StrCopy(file2,arg,pos) -> now the file variable contains
- ENDIF -> the file name
-
- StringF(file,'\s \s',file,file2)
- ENDIF
-
- pos:=InStr(arg,'0x',0) -> replace all 0x with ' $'
- arg[pos]:=$20;arg[pos+1]:=$24 -> Val() needs hexadecimal numbers...
- re:=Val(arg+pos,0) -> (get the value)
- -> ...to be preceded by '$'
-
- IF newtitle:=New(StrLen(re.easystr.title)+2)-> title MUST be preceded by a space
- -> we do not want an infinitive loop!
- StringF(newtitle,' \s',re.easystr.title)
- -> run the command...
- SystemTagList(file,NIL)
- -> now call the requester...
- exit:=EasyRequestArgs(0,[20,0,newtitle,re.easystr.textformat,re.easystr.gadgetformat],0,0)
- ENDIF
- ENDPROC exit
-